<template>
  <div class="life-container">
    <h2>生命周期</h2>
    <button @click="num++">{{ num }}</button>
  </div>
</template>

<script>
export default {
  data() {
    return {
      num: 99
    }
  },
  beforeCreate() {
    console.log('beforeCreate');
  },
  created() {
    console.log('created');
  },
  beforeMount() {
    console.log('beforeMount');
  },
  mounted() {
    console.log('mounted');
  },
  beforeUpdate() {
    console.log('beforeUpdate', this.num);
  },
  updated() {
    console.log('updated', this.num);
  },
  beforeDestroy() {
    console.log('beforeDestroy');
  },
  destroyed() {
    console.log('destroyed');
  },
  watch: {
    num(newV, oldV) {
      console.log(newV, oldV)
    }
  }
}
</script>
